<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>
    <#if ext2 ?? && ext2 ==1>
                 线上转盘列表
    <#else>
                线下转盘列表
    </#if>         
    </title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <#include "/view/admin/head.html"/>
    <style type="text/css">
        .table-class{
            width:80%;
            text-align: center;
            border:1px solid #afd9ee;
            margin:0 auto;
            margin-top: 50px;
        }
        .list-path{
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;

        }
        table th{
            text-align: center;
        }
        table thead tr {
            background-color: #9acfea;
        }
        .table-query{
            /*height: 40px;*/
            /*width:80px;*/
            /*text-align: center;*/
            white-space:nowrap;

        }
    </style>
    <script type="text/javascript">
        function query(dm){
            var actname = $('#actname').val();
            var actType = $('#actType').val();
            location.href='${base}/roulette/czjrouletteActList.do?actname='+actname+'&actType='+actType;
        }
    </script>
</head>
<body>


    <#if ext2 ?? && ext2 ==1>
<#include "/view/admin/listnav.html"/> 
    <#else>
<#include "/view/admin/listnav.html"/> 
    </#if> 

      

<div class="table-class">
    <div class="panel panel-default" style="margin: 10px 50px 10px;">
     <div class="panel-body">
        <form class="bs-example bs-example-form" role="form">


            <div class="input-group">
                <span class="input-group-addon">活动名称</span>
                <input type="text" id="actname" class="form-control" style="width:200px;" value="${actname!}" placeholder="请输入活动名称">
   
                <span class="input-group-addon">活动类型</span>
                  <select id="actType" name="actType"  class="form-control" style="width:202px;"  >
                    <option value="">请选择</option>
                    <option value="1" <#if actType?? && actType==1>  selected="selected"  </#if> >转盘活动</option>
                    <option value="2" <#if actType?? && actType==2>  selected="selected"  </#if> >二维码活动</option>
                  </select> 
            </div>
                 <span class="bank-label">&nbsp;</span>                                                  
            <div class="input-group" style="text-align: right;">
                <a class="btn btn-info"  href="javascript:query(this)"><span class="glyphicon glyphicon-search"></span> 查找</a>

            </div>
        </form>
     </div>
  </div>
      <#if  message??  >
        <div class="alert alert-error" style="background-color: write;color: red;">           
           <font size="5"><strong>${message!}</strong></font>
        </div>
     </#if>
      <hr/>
    <div style="text-align:left;  padding:10px;">
    <@shiro.hasPermission name="10.1.4">	
		<input type="button" class="btn btn-primary" value="新增 " onclick="javascript:location.href='czjrouletteActAdd.do'"/>
    </@shiro.hasPermission>
   </div>      
    <table class="table table-hover">
        <thead>
        <tr>
	    	 
   	 <th>活动名称</th>
   	 <th>活动类型</th>
     <th width="330">操作选项</th>
        </tr>
        </thead>
        <tbody>
        <#list pagination.list as c>
            <tr>

 <td>${c.actname!?html}</td>
 <td>
    <#if c.actType?? && c.actType ==1>
              转盘活动
    <#else>
              二维码活动
    </#if>
 </td>
 
 
	<td align="center">	
<@shiro.hasPermission name="10.1.2">   
   <a href="czjawardDetails.do?rouletteId=${c.rouletteId}&actionEdit=true&ext2=${ext2!}" class="btn btn-primary">预览</a> 
</@shiro.hasPermission>	
<@shiro.hasPermission name="10.1.2">   
   <a href="czjrouletteActEdit.do?rouletteId=${c.rouletteId}&actionEdit=true&ext2=${ext2!}" class="btn btn-primary">修改</a> 
</@shiro.hasPermission>
<@shiro.hasPermission name="10.1.2"> 
    <#if c.actType?? && c.actType ==1>
      <a href="czjrouletteEditcode.do?rouletteId=${c.rouletteId}&actionEdit=true&ext2=${ext2!}&bs=${c.imgOrder!}" class="btn btn-primary">预览二维码</a> 
    <#else>
      <a href="czjcodeEditcode.do?rouletteId=${c.rouletteId}&actionEdit=true&ext2=${ext2!}&bs=${c.imgOrder!}" class="btn btn-primary">预览二维码</a> 
    </#if>
</@shiro.hasPermission>
<@shiro.hasPermission name="10.1.3">   
   <!-- <a href="czjrouletteDelete.do?ids=${c.rouletteId}&ext2=${ext2!}" onclick="if(!confirm('您确定删除吗？')) {return false;}" class="btn btn-primary">删除</a>  -->  
</@shiro.hasPermission>  
   </td>
            </tr>


        </#list>
        <#if 0==pagination.totalCount>
            <tr>
                <td colspan="7" style="color: red"> 没有相关数据 </td>
            </tr>
        </#if>




        </tbody>
    </table>
    
   <#include "/view/admin/pagination.html"/>

</div>
<script>

function setPage(pageNo,pageSize){
    var lianjie=document.location.href;
    var lianjie = lianjie.substr(0,lianjie.indexOf('?'))
    var href = lianjie+"?";
    href+=queryCondition();
    href+="&pageNo="+pageNo;
    href+="&pageSize="+pageSize;
    location.href=href;
}
function queryCondition(){
	
    var actname = $('#actname').val();
    var actType = $('#actType').val();
	var str = '';
    str +='actname='+actname+'&actType='+actType;		
	return str;			
}

    $(function () {
        $('[data-toggle="popover"]').each(function () {
            var element = $(this);
            var id = element.attr('id');
            var count = '0';
            var key = $(this).parent().find('input[class=userinfoId]').attr('id');
            var userinfoId=$(this).parent().find('input[class=userinfoId]').val();
            var ticket=$(this).parent().find('input[class=ticket]').val();
            element.popover({
                trigger: 'manual',
                placement: 'bottom', //top, bottom, left or right
                title: '修改票数',

                html: 'true',
                content: ContentMethod(key,userinfoId,ticket),
            }).on("click", function () {
                var _this = this;
                $(this).popover("show");
               /* $(this).siblings(".popover").on("mouseleave", function () {
                    $(_this).popover('hide');
                });*/
            })/*.on("mouseleave", function () {

                var _this = this;
                setTimeout(function () {
                    if (!$(".popover:hover").length) {
                        $(_this).popover("hide")
                    }
                }, 100);
            })*/;
        });
    });
    function ContentMethod(key,userinfoId,ticket) {
        return '<form action="${base}/vote/savevotenum.do" method="POST"><table class="table table-bordered"><tr><td><input type="hidden"  name="id" value="'+userinfoId+'"/><input type="text" placeholder="票数" name="voteNum" value="'+ticket+'"/> </td></tr><tr><td><button type="submit" class="btn btn-success" >修改</button>&nbsp;&nbsp;<button type="button" class="btn btn-danger" onclick="closePPv('+key+')">取消</button> </td></tr></table></form>';
    }
    function closePPv(key){
        $(key).siblings('a[class=ppov]').popover('hide');
    }





</script>

</body>
</html>